package org.alvin.i18n.newui;

import com.alibaba.fastjson.JSONObject;

public class JSONToKey {

    public static void main(String[] args) {
        String text = "{\n" +
                "\t \n" +
                "\t\"myOrder\":{\n" +
                "\t\t\"dingdanleixing\":\"订单类型\",\n" +
                "\t\t\"baoyuedingdan\":\"包月订单\",\n" +
                "\t\t\"linshichongdian\":\"临时充电\"\n" +
                "\t},\n" +
                "\t\"carpiledetail\":{\n" +
                "\t\t\"ninyiquxiaozhifu\":\"您已取消支付\",\n" +
                "\t\t\"tijiaodeshuju\":\"提交的數據\"\n" +
                "\t},\n" +
                " \n" +
                "\t\"emailLogin\":{\n" +
                "\t\t\"dianziyouxiang\":\"电子邮箱\",\n" +
                "\t\t\"huidaoshouye\":\"回到首页\", \n" +
                "\t\t\"mimadenglu\":\"密码登录\",\n" +
                "\t\t\"qitadenglufangshi\":\"其他登录方式\",\n" +
                "\t\t\"duanxindenglu\":\"短信登录\" \n" +
                "\t}, \n" +
                "\t\"wxNewLogin\":{\n" +
                "\t\t\"huidaoshouye\":\"回到首页\", \n" +
                "\t\t\"qitadenglufangshi\":\"其他登录方式\" \n" +
                "\t}, \n" +
                "\t\"AccountAndPasswordLogin\":{\n" +
                "\t\t\"huidaoshouye\":\"回到首页\", \n" +
                "\t\t\"qitadenglufangshi\":\"其他登录方式\",\n" +
                "\t\t\"duanxindenglu\":\"短信登录\" \n" +
                "\t}, \n" +
                "\t\"addFeedback\":{\n" +
                "\t\t\"shangchuanwenjian\":\"上传文件：\",\n" +
                "\t\t\"shangchuanwenjianshibai\":\"上传文件失败\"\n" +
                "\t}, \n" +
                "\t\"stripePay\":{\n" +
                "\t\t\"ninyiquxiaozhifu\":\"您已取消支付\",\n" +
                "\t\t\"tijiaodeshuju\":\"提交的數據\"\n" +
                "\t}, \n" +
                "\t\"SetPassword\":{\n" +
                "\t\t\"zanbushezhitiaoguo\":\"暂不设置，跳过\",\n" +
                "\t\t\"ninhaimeiyoushezhimimashezhimimahoukeyizhijieshiyongmimadenglu\":\"您还没有设置密码，设置密码后，可以直接使用密码登录\"\n" +
                "\t} \n" +
                "}";

        JSONObject jsonObject = JSONObject.parseObject(text);
        JSONObject result = new JSONObject();
        for (String key : jsonObject.keySet()) {
            JSONObject item = jsonObject.getJSONObject(key);
            for (String ckey : item.keySet()) {
                result.put(key + "." + ckey, item.get(ckey));
            }
        }
        System.out.println(result);
    }
}
